/*
 * @Author: 江舟 jijiangzhou@recycloud.cn
 * @Date: 2024-04-09 14:45:21
 * @LastEditors: 江舟 jijiangzhou@recycloud.cn
 * @LastEditTime: 2024-06-26 15:30:01
 * @FilePath: \vite-project\src\components\common\FixedBottomButton.tsx
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { useCommonStore } from 'store/common';
import { Button, Space } from 'antd';
import { createPortal } from 'react-dom';

export default (props: any) => {
    const { menuCollapsed } = useCommonStore();
    const back = () => {
        history.back();
    };
    return createPortal(
        <div>
            <div
                className={`bg-white fixed bottom-0 right-0 h-48px box-border border-0px border-t-1px border-[#eee] border-solid z-9 ${
                    menuCollapsed ? 'left-80px' : 'left-250px'
                } flex justify-end p-12px`}
            >
                <Space>
                    {props?.hideBack ? null : <Button onClick={back}>返回</Button>}
                    {props?.children}
                    {!props?.hideSubmit ? (
                        <Button
                            type='primary'
                            onClick={props.onSubmit}
                            loading={props?.loading}
                            disabled={props?.disabled}
                        >
                            {props.submitText || '提交'}
                        </Button>
                    ) : null}
                </Space>
            </div>
            <div className='h-48px'></div>
        </div>,
        document.body,
    );
};
